from rest_framework import serializers
from .models import NewsInformation

class NewsInformationSerializer(serializers.ModelSerializer):
    category_display = serializers.CharField(
        source='get_category_display', read_only=True)  # 返回中文名
    class Meta:
        model = NewsInformation
        fields = '__all__'  # 序列化所有字段